package com.clqteam.daoimpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import com.clqteam.dao.UpdateVIPLXGDao;
import com.clqteam.util.JDBCutil;
/**
 * VIP修改功能的Dao
 * @author Administrator
 *LXG
 */
public class UpdateVIPLXGDaoImpl implements UpdateVIPLXGDao{
	/**
	 * 通过VIP的id修改VIP的信息
	 * @param vId id
	 * @param vPiont 积分
	 * @param pitRate 转化率
	 * @param vDiacount 折扣率
	 * @param vTime 开通日期
	 * @return boolean
	 */
	@Override
	public boolean updateVIPByVid(int vId, int vPoint, double pitRate, double vDiscount, String vTime) {
		boolean bl=false;
		StringBuffer sql=new StringBuffer("");
		sql.append(" UPDATE s_vip SET s_vip.vPoint=?,s_vip.pitRate=?,s_vip.vDiscount=?,s_vip.vTime=?");
		sql.append(" WHERE s_vip.vId=?");
		Connection con=JDBCutil.getConnection();
		try {
			PreparedStatement ps=con.prepareStatement(sql.toString());			
			ps.setInt(1, vPoint);
			ps.setDouble(2, pitRate);
			ps.setDouble(3, vDiscount);
			ps.setString(4, vTime);
			ps.setInt(5, vId);
			int i=ps.executeUpdate();
			if(i>0){
				bl=true;
			}
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return bl;
	}

}
